<?php

namespace App\Service\Balance;

use App\Models\Balance\BalanceModel;
use DB;

class BalanceService
{
    public static function addBalanceLog(array $data)
    {
        if( !BalanceModel::insert($data) ){
            return false;
        }
        return true;
    }

    public static function getBalanceLog($uid = '', $offset = 0)
    {
        $result = DB::select("select a.created_at,a.money,a.type,a.title as deal_title,b.title as article_title,a.order_id
from lsj_balance_log a 
left join lsj_article b on a.article_id=b.id 
where a.uid=?
order by a.id DESC
limit ?,10 ",[$uid,$offset]);
        return $result;
    }
}